#pragma once
#include <utility>

namespace yx
{
	namespace pattern
	{
		template<typename T>
		class Singleton
		{
		public:
            template<typename... Args>
			static T* instance(Args... args)
			{
				static T obj(std::forward<Args>(args)...); // C++11Դ̰߳ȫ(since c++11)
				return &obj;
			}
		private:
			Singleton() = default;
			~Singleton() = default;
			Singleton(const Singleton<T>&) = delete;
			Singleton<T>& operator=(const Singleton<T>&) = delete;
		};

	}
}